< previous page page_63 next page >

Page 63
After you have placed the controls on the form and sized them, you need to place the code from Listing 3.10 in the declaration section of the form. This code declares several variables that you use throughout the form.
Type.gifListing 3.10. Declaration code for the TBSEEK.VBP project.
Option Explicit
'
' form-level variables
'
Dim db As Database
Dim rs As Recordset
'
Dim strDBName As String
Dim strRSName As String
Dim strIndex As String
Dim strField As String
Place the code from Listing 3.11 in the Form_Load event of the form. This code opens the BOOKS5.MDB database and opens the Titles table.
Type.gifListing 3.11. Coding the Form_Load routine of TBSEEK.VBP.
Private Sub Form_Load()
    '
    ' set vars
    strDBName = App.Path & "\..\..\Data\Books5.mdb"
    strRSName = "Titles"
    '
    ' open database and table
    Set db = DBEngine.OpenDatabase(strDBName)
    Set rs = db.OpenRecordset(strRSName, dbOpenTable)
    '
End Sub
Place the procedure shown in Listing 3.12 in the declaration section. This is the procedure that sets the table index and loads the list box in the proper order.
Type.gifListing 3.12. Coding the LoadList routine of TBSEEK.VBP.
Public Sub LoadList()
    '
    ' load data collection into list box
    '
continues

 
< previous page page_63 next page >

If you like this book, buy it!